<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Simulateur du jeu d&#39;instructions d&#39;un processeur simple:  Fichier source de machine.h</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Généré par Doxygen 1.7.4 -->
<script type="text/javascript">
function hasClass(ele,cls) {
  return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}

function addClass(ele,cls) {
  if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}

function removeClass(ele,cls) {
  if (hasClass(ele,cls)) {
    var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    ele.className=ele.className.replace(reg,' ');
  }
}

function toggleVisibility(linkObj) {
 var base = linkObj.getAttribute('id');
 var summary = document.getElementById(base + '-summary');
 var content = document.getElementById(base + '-content');
 var trigger = document.getElementById(base + '-trigger');
 if ( hasClass(linkObj,'closed') ) {
   summary.style.display = 'none';
   content.style.display = 'block';
   trigger.src = 'open.png';
   removeClass(linkObj,'closed');
   addClass(linkObj,'opened');
 } else if ( hasClass(linkObj,'opened') ) {
   summary.style.display = 'block';
   content.style.display = 'none';
   trigger.src = 'closed.png';
   removeClass(linkObj,'opened');
   addClass(linkObj,'closed');
 }
 return false;
}
</script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Simulateur du jeu d'instructions d'un processeur simple</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Page&#160;principale</span></a></li>
      <li><a href="annotated.html"><span>Structures&#160;de&#160;données</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
      <li><a href="dirs.html"><span>Répertoires</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Liste&#160;des&#160;fichiers</span></a></li>
      <li><a href="globals.html"><span>Portée&#160;globale</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('machine_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">machine.h</div>  </div>
</div>
<div class="contents">
<a href="machine_8h.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef _MACHINE_H_</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define _MACHINE_H_</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;stdbool.h&gt;</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;<a class="code" href="instruction_8h.html" title="Description du jeu d&#39;instruction.">instruction.h</a>&quot;</span>
<a name="l00012"></a>00012 
<a name="l00014"></a><a class="code" href="machine_8h.html#a7fc2a43e54def648bc97e9f533a1e42f">00014</a> <span class="preprocessor">#define NREGISTERS 16</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span>
<a name="l00017"></a>00017 
<a name="l00026"></a><a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3">00026</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> 
<a name="l00027"></a>00027 {
<a name="l00028"></a><a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3a04c3a93ec576a8d75cd95ad495f58cfc">00028</a>     <a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3a04c3a93ec576a8d75cd95ad495f58cfc" title="Signe du résultat inconnu.">CC_U</a> = 0,   
<a name="l00029"></a><a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3a956fd0d2f14871f1999334a1a5d6e74f">00029</a>     <a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3a956fd0d2f14871f1999334a1a5d6e74f" title="Résultat nul.">CC_Z</a>,   
<a name="l00030"></a><a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3af95cd91008581d4a445a565d66206a3c">00030</a>     <a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3af95cd91008581d4a445a565d66206a3c" title="Résultat positif.">CC_P</a>,   
<a name="l00031"></a><a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3a3c6fed66f14c571f360998834734cf3b">00031</a>     <a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3a3c6fed66f14c571f360998834734cf3b" title="Résultat négatif.">CC_N</a>,   
<a name="l00032"></a>00032 } <a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3" title="Code condition.">Condition_Code</a>;
<a name="l00033"></a>00033 
<a name="l00035"></a>00035 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> LAST_CC = <a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3a3c6fed66f14c571f360998834734cf3b" title="Résultat négatif.">CC_N</a>;
<a name="l00036"></a>00036 
<a name="l00038"></a>00038 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> MINSTACKSIZE = 10;
<a name="l00039"></a>00039 
<a name="l00041"></a>00041 
<a name="l00070"></a><a class="code" href="structMachine.html">00070</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072     <span class="comment">// Segments de mémoire</span>
<a name="l00073"></a><a class="code" href="structMachine.html#a052e945d3eab840b58171c53a873aec3">00073</a>     <a class="code" href="unionInstruction.html" title="Structure d&#39;une instruction.">Instruction</a> *<a class="code" href="structMachine.html#a052e945d3eab840b58171c53a873aec3" title="Mémoire pour les instructions.">_text</a>;     
<a name="l00074"></a><a class="code" href="structMachine.html#a6a405b4b09d4e566cf27f0bed3505b11">00074</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structMachine.html#a6a405b4b09d4e566cf27f0bed3505b11" title="Taille utilisée pour les instructions.">_textsize</a>; 
<a name="l00075"></a>00075 
<a name="l00076"></a><a class="code" href="structMachine.html#ac2949056c217e69a8efe6a114d2ac2b0">00076</a>     <a class="code" href="instruction_8h.html#a0b5b15ce5f3a75b5dd0de6643cd3d958" title="Type d&#39;un mot de donnée.">Word</a> *<a class="code" href="structMachine.html#ac2949056c217e69a8efe6a114d2ac2b0" title="Mémoire de données.">_data</a>;        
<a name="l00077"></a><a class="code" href="structMachine.html#a8a50815b359c1602c95edd3459ad05c8">00077</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structMachine.html#a8a50815b359c1602c95edd3459ad05c8" title="Taille utilisée pour les données.">_datasize</a>; 
<a name="l00078"></a>00078 
<a name="l00079"></a><a class="code" href="structMachine.html#a4cf57550abe18e1dece177fb8794d6c0">00079</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structMachine.html#a4cf57550abe18e1dece177fb8794d6c0" title="Première adresse libre après les données statiques.">_dataend</a>;      
<a name="l00080"></a>00080 
<a name="l00081"></a>00081     <span class="comment">// Registres de l&#39;unité centrale</span>
<a name="l00082"></a><a class="code" href="structMachine.html#a1b3345874b1ade4324f16f3e03944675">00082</a>     <span class="keywordtype">unsigned</span> <a class="code" href="structMachine.html#a1b3345874b1ade4324f16f3e03944675" title="Compteur ordinal.">_pc</a>;       
<a name="l00083"></a><a class="code" href="structMachine.html#adbb793b4331ed11783001895c76b6d4c">00083</a>     <a class="code" href="machine_8h.html#a4bc92b6f72076bb5dd651a143f58a2c3" title="Code condition.">Condition_Code</a> <a class="code" href="structMachine.html#adbb793b4331ed11783001895c76b6d4c" title="Code condition : signe de la dernière opération.">_cc</a>;     
<a name="l00084"></a><a class="code" href="structMachine.html#ab4a927b1e214bd40d2406f1080eaa6c4">00084</a>     <a class="code" href="instruction_8h.html#a0b5b15ce5f3a75b5dd0de6643cd3d958" title="Type d&#39;un mot de donnée.">Word</a> _registers[<a class="code" href="machine_8h.html#a7fc2a43e54def648bc97e9f533a1e42f" title="Nombre de resitres généraux.">NREGISTERS</a>];
<a name="l00085"></a>00085 
<a name="l00087"></a><a class="code" href="machine_8h.html#aeed5ab4a0b09c5593a7ac3d93739b0ca">00087</a> <span class="preprocessor">#   define _sp _registers[NREGISTERS - 1] </span>
<a name="l00088"></a>00088 <span class="preprocessor"></span>} <a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a>;
<a name="l00089"></a>00089 
<a name="l00091"></a>00091 
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="machine_8h.html#a9ac26e6f927cf2956823b4f9588d44df" title="Chargement d&#39;un programme.">load_program</a>(<a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a> *pmach,
<a name="l00102"></a>00102                   <span class="keywordtype">unsigned</span> <a class="code" href="prog__simple-bin_8c.html#a09c9805cec0364d715497e6564245c48" title="Taille utile du programme.">textsize</a>, <a class="code" href="unionInstruction.html" title="Structure d&#39;une instruction.">Instruction</a> <a class="code" href="prog__simple-bin_8c.html#a53ae7c86b11d9a664628491ba41ca09d" title="Segment de texte.">text</a>[textsize],
<a name="l00103"></a>00103                   <span class="keywordtype">unsigned</span> <a class="code" href="prog__simple-bin_8c.html#a5c7949e884a8b9b3d1ab9f070267bf33" title="Taille utile du segment de données.">datasize</a>, <a class="code" href="instruction_8h.html#a0b5b15ce5f3a75b5dd0de6643cd3d958" title="Type d&#39;un mot de donnée.">Word</a> <a class="code" href="prog__simple-bin_8c.html#a0a1a7765b8d407ad9c19649d5a9dd699" title="Premier exemple de segment de données initial.">data</a>[datasize],  <span class="keywordtype">unsigned</span> <a class="code" href="prog__simple_8c.html#ad74734ae58f284f6cc955dfecf50f0d0" title="Fin de la zone de données utiles.">dataend</a>);
<a name="l00104"></a>00104 
<a name="l00106"></a>00106 
<a name="l00126"></a>00126 <span class="keywordtype">void</span> <a class="code" href="machine_8h.html#ac59b88844961c2479108151e24dd555a" title="Lecture d&#39;un programme depuis un fichier binaire.">read_program</a>(<a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a> *mach, <span class="keyword">const</span> <span class="keywordtype">char</span> *programfile);  
<a name="l00127"></a>00127  
<a name="l00129"></a>00129 
<a name="l00139"></a>00139 <span class="keywordtype">void</span> <a class="code" href="machine_8h.html#aa69650bbdba0125402a22c4451755412" title="Affichage du programme et des données.">dump_memory</a>(<a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a> *pmach);
<a name="l00140"></a>00140 
<a name="l00142"></a>00142 
<a name="l00147"></a>00147 <span class="keywordtype">void</span> <a class="code" href="machine_8h.html#aba3ce4987ef379073d9d3f31debf89e7" title="Affichage des instructions du programme.">print_program</a>(<a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a> *pmach);
<a name="l00148"></a>00148 
<a name="l00150"></a>00150 
<a name="l00155"></a>00155 <span class="keywordtype">void</span> <a class="code" href="machine_8h.html#a549be6eaf631d871e9357513c748640d" title="Affichage des données du programme.">print_data</a>(<a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a> *pmach);
<a name="l00156"></a>00156 
<a name="l00158"></a>00158 
<a name="l00163"></a>00163 <span class="keywordtype">void</span> <a class="code" href="machine_8h.html#a87cfff30238b966cfc3c0c416d7076e9" title="Affichage des registres du CPU.">print_cpu</a>(<a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a> *pmach);
<a name="l00164"></a>00164 
<a name="l00166"></a>00166 
<a name="l00174"></a>00174 <span class="keywordtype">void</span> <a class="code" href="machine_8h.html#ad0bfa0ce7434b963eea888d7b847ac3b" title="Simulation.">simul</a>(<a class="code" href="structMachine.html" title="Structure générale de la machine.">Machine</a> *pmach, <span class="keywordtype">bool</span> debug);
<a name="l00175"></a>00175 
<a name="l00176"></a>00176 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="machine_8h.html">machine.h</a>      </li>
      <li class="footer">Généré le Tue May 31 2011 11:25:41 pour Simulateur du jeu d'instructions d'un processeur simple par&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
    </ul>
  </div>

</body>
</html>
